<?php

namespace App\Models\Personnel;

use Illuminate\Database\Eloquent\Model;
use Prettus\Repository\Contracts\Transformable;
use Prettus\Repository\Traits\TransformableTrait;

class Station extends Model implements Transformable
{
    use TransformableTrait;

    protected $table='station';

    protected $fillable = ['name','role_id','station_class_id','order_no','created_user','updated_user'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     * 辅助岗位对应的用户
     */
    public function users(){
        return $this->belongsToMany('App\Models\System\user','user_station','station_id','user_id')->withPivot('created_user')->withTimestamps();
    }

    public function role(){
        return $this->belongsTo('App\Models\System\Role');
    }

}
